modes = {}

def get_handler(name, *args, **kwargs):
    m = modes.get(name)
    if m is not None:
        return m(*args, **kwargs)
    return None

class Mode(object):
    name = None

    def __init__(self):
        self.window = None

    def connect(self, control):
        # Inherits window from controller
        self.window = control.window

    def disconnect(self):
        pass

    def update(self, dt):
        pass
